package org.dbc;
import java.sql.*;
public class DatabaseConnection {
   private Connection conn = null;
   private static final String url = "jdbc:oracle:thin:127.0.0.1:1521:orac";
   private static final String userName = "system";
   private static final String password = "xg123";
   public DatabaseConnection() throws Exception{
	   try{
		   Class.forName("oracle.jdbc.OracleDriver");
	   }
	   catch(ClassNotFoundException e){
		   e.printStackTrace();
	   }
	   try{
		   conn = DriverManager.getConnection(url, userName, password);
	   }
	   catch(SQLException e){
		   e.printStackTrace();
	   }
   }
   public Connection getConn() throws Exception{
	   return conn;
   }
   public void close() throws Exception{
	   if(conn!=null)
		   conn.close();
   }
}
